const express = require('express');
const { authMiddleware } = require('../../middlewares/authMiddleware');
const { apiPathMiddleware } = require('../../middlewares/apiPathMiddleware');
const skuController = require('../../controllers/product/skuController');

const router = express.Router();

// 查看sku列表
router.get('/list/:page/:limit', skuController.getSkuList);
// 上架
router.get('/onSale/:skuId', authMiddleware, apiPathMiddleware('sku/onSale'), skuController.onSale);
// 下架
router.get('/cancelSale/:skuId', authMiddleware, apiPathMiddleware('sku/onSale'), skuController.cancelSale);
// 获取某个SKU详细数据
router.get('/getSkuInfo/:skuId', skuController.getSkuDetail);
// 删除SKU
router.delete('/deleteSku/:skuId', authMiddleware, apiPathMiddleware('sku/remove'), skuController.deleteSku);

module.exports = router;
